#include <stdio.h>
#include <stdlib.h>
#include<conio.h>

int main()
{
    int i,j;
    int x=10;
    int y=5;
    char input;
    int score=0;

    int ny =5;

    int isfired=0;
    int iskilled=0;

    while(1)
    {
        system("cls");
        if (iskilled==0)
        {
            for (i=0;i<ny;i++)
                printf(" ");
            printf("+\n");
        }
        if(iskilled==1)
        {
            ny=ny+2;
            for (i=0;i<ny;i++)
                printf(" ");
            printf("+\n");
            iskilled=0;
        }

        if(isfired==0)
        {
            for (i=0;i<x;i++)
                printf("\n");
        }
        else
        {
            for (i=0;i<x;i++)
            {
                for (j=0;j<y;j++)
                    printf(" ");
                printf("  |\n");
            }

            if(y+2==ny)
            {
                iskilled=1;
                score++;

            }

            isfired =0;
    }

/*
    for (i=0;i<x;i++)
        printf("\n");
    for (j=0;j<y;j++)
        printf(" ");
        */

    for (j=0;j<y;j++)
        printf(" ");
    printf(" \n");


    for (j=0;j<y;j++)
        printf(" ");
    printf("  *\n");
    for (j=0;j<y;j++)
        printf(" ");
    printf("*****\n");
    for (j=0;j<y;j++)
        printf(" ");
    printf(" * * \n");
    for (j=0;j<y;j++)
        printf(" ");
    printf("score=%d",score);


    input=getch();//scanf("%c",&input);
    if(input=='s')
        x++;
    if(input=='w')
        x--;
    if(input=='a')
        y--;
    if(input=='d')
        y++;
    if(input==' ')
        isfired=1;
    }
    return 0;
}
